package cn.lichenfei.jfx.music.common.model;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author ChenFei
 * @date 2022/4/23
 */
@Data
@NoArgsConstructor
public class AudioInfo {

    private String path;
    private String name;
    private Boolean internalResource;

    public AudioInfo(String path, Boolean internalResource) {
        this.path = path;
        this.internalResource = internalResource;
    }

    public AudioInfo(String name, String path, Boolean internalResource) {
        this.name = name;
        this.path = path;
        this.internalResource = internalResource;
    }

    public Boolean getInternalResource() {
        return internalResource;
    }

    public String getPath() {
        return path;
    }

    public String getName() {
        if (StrUtil.isBlank(this.name)) {
            return FileUtil.getName(this.path);
        }
        return this.name;
    }
}
